package foo;


import java.text.ParseException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @package foo
 * @Class Method
 * @Description TODO
 * @Author zhangxinhua
 * @Date 19-9-14 上午9:26
 */
public class Method {
    public static void main(String[] args) throws ParseException, NoSuchMethodException {
        List<String> stringList = Arrays.asList("He llo", "World");
        List<String> collect = stringList.stream().map(world -> world.split(" ")).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
        collect.forEach(System.out::println);
        List<Integer> integerList = Arrays.asList(1, 2, 3, 4, 5);
        Map<Boolean, List<Integer>> collect1 = integerList.stream().collect(Collectors.groupingBy(
                a -> a > 3));
        System.out.println(collect1);
        String collect2 = integerList.stream().map(a -> a + "").collect(Collectors.joining(", "));
        System.out.println(collect2);
        integerList.stream().iterator();
    }
}
